<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '会员卡列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="tenant-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('新建会员卡t', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            // ['class' => 'yii\grid\SerialColumn'],
            'id',
            'card_id',
            [
            // 'class' => 'yii\grid\ActionColumn','header'=>'操作','template' => '{add} {view} {update} {delete}',
            'class' => 'yii\grid\ActionColumn','header'=>'操作','template' => '{view}',
            'buttons' => [
                'view' => function ($url, $model) {
                    // var_dump($model);die;
                    $url = "view?card_id=" . $model['card_id'];
                    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, ['title' => '查看', 'target' => '_blank']);
                    },
                ]
            ],
        ],
    ]); ?>
</div>
